﻿@model IEnumerable<VenueSummaryViewModel>

@{ ViewBag.Title = "Venue search"; }

<section>
    <div class="grid_6">
        <h2>@ViewBag.Title</h2>
        @Html.Partial("AutoComplete/_Venue", "venueAutoComplete")
    </div>

    <div class="grid_6 rtl clearfix">
        @Html.ActionLink("Add new venue", "Index", "Editor", null, new { @class = "k-button" })
    </div>

    <div class="grid_12 clearfix">
        @Html.DisplayForModel("VenueSearchResults")
    </div>
</section>

<script type="text/javascript">
    function venueAutoCompleteAdditionalData() {
        return { text: $("#venueAutoComplete").val() };
    }

    function venueAutoComplete_onChange() {
        var url = '@Url.Action("Index", new { id = "__REPLACE__" })';
        window.location.href = url.replace('__REPLACE__', $("#venueAutoComplete").val());
    }
</script>